/*
 * Copyright (C) 2013 Daniel Treffenstädt <daniel@treffenstaedt.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#include "OGUIObject.h"

O_START_NAMESPACE

GUIObject::GUIObject() :
	m_minSize(Size(0, 0)),
	m_size(Size(200, 100)),
	m_maxSize(Size(-1, -1)),
	m_position(Position(0, 0)),
	m_stretch(Stretch::Normal),
	m_visible(false),
	m_changed(false)
{
}

GUIObject::GUIObject(Size s) :
	m_minSize(Size(0, 0)),
	m_size(s),
	m_maxSize(Size(-1, -1)),
	m_position(Position(0, 0)),
	m_stretch(Stretch::Normal),
	m_visible(false),
	m_changed(false)
{
}

void GUIObject::setMinSize(Size s)
{
	m_minSize	= s;
}

Size GUIObject::minSize()
{
	return m_minSize;
}

void GUIObject::setMaxSize(Size s)
{
	m_maxSize	= s;
}

Size GUIObject::maxSize()
{
	return m_maxSize;
}

void GUIObject::resize(Size s)
{
	m_size	= s;
	setChange(true);
}

Size GUIObject::size()
{
	return m_size;
}

unsigned short GUIObject::width()
{
	return m_size.width();
}

unsigned short GUIObject::height()
{
	return m_size.height();
}

void GUIObject::move(Position p)
{
	m_position	= p;
	setChange(true);
}

Position GUIObject::position()
{
	return m_position;
}

unsigned short GUIObject::x()
{
	return m_position.x();
}

unsigned short GUIObject::y()
{
	return m_position.y();
}

void GUIObject::setStretch(Stretch s)
{
	m_stretch	= s;
}

GUIObject::Stretch GUIObject::stretch()
{
	return m_stretch;
}

void GUIObject::hide()
{
	setVisible(false);
}

void GUIObject::show()
{
	setVisible(true);
}

bool GUIObject::visible()
{
	return m_visible;
}

bool GUIObject::changed()
{
	return m_changed;
}

void GUIObject::setVisible(bool state)
{
	m_visible	= state;
	setChange(true);
}

void GUIObject::setChange(bool state)
{
	m_changed	= state;
}

O_END_NAMESPACE
